<?php

namespace App\Enums;

use App\Traits\EnumTrait;

class PayTypeEnum
{

    use EnumTrait;

    const ENUM = [
        ['payType' => 1,'text' => '微信小程序支付'],
        ['payType' => 2,'text' => '微信APP支付'],
        ['payType' => 3,'text' => '支付宝APP支付'],
    ];

    const WECHAT_MINI = 1;
    const WECHAT_APP = 2;
    const ALI_APP = 3;


    public static function getTextByPayType($payType)
    {
        foreach (self::ENUM as $item) {
            if ($payType == $item['payType']) {
                return $item['text'];
            }
        }
        return null;
    }

    public static function getAllByPayType(): array
    {
        return array_column(self::ENUM,'text','payType');
    }
}
